<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all"/>
    <style>
        .layui-form-item .layui-input-inline {
            width: 150px;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title layui_tab_title">
                <li><a href="{:url('worldcup/index')}">赛事</a></li>
                <li><a href="{:url('worldcup/point')}">积分</a></li>
                <li><a href="{:url('worldcup/rank')}">晋级图</a></li>
                <li><a href="{:url('WorldCupGuess/index')}">竞猜</a></li>
                <li class="layui-this"><a href="{:url('WorldCupGuess/order')}">竞猜记录</a></li>
            </ul>
        </div>
        <form class="layui-form" id="sbumitForm">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <div class="layui-form-item">
                    <div class="layui-inline ">
                        <label class="layui-form-label">用户手机号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="mobile" placeholder="用户手机号" autocomplete="off" class="layui-input"/>
                        </div>
                    </div>
                    <div class="layui-inline ">
                        <label class="layui-form-label">用户昵称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="nick_name" placeholder="用户昵称" autocomplete="off" class="layui-input"/>
                        </div>
                    </div>
                    <div class="layui-inline ">
                        <div class="layui-input-inline">
                            <div class="layui-btn" id="submit">
                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-card-body layui-table-body layui-table-main">
            <table id="demo" lay-filter="demo"></table>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: "/layuiadmin/" //静态资源所在路径
    }).extend({
        index: "lib/index", //主入口模块
    }).use(["table", 'form'], function () {
        $ = layui.jquery, form = layui.form, table = layui.table;

        table.render(table_conf());

        $("#submit").click(function () {
            table.render(table_conf());
        });
    });

    function table_conf() {
        return {
            elem: '#demo',
            id: '#demo',
            url: '/admin/world_cup_guess/order?' + $("#sbumitForm").serialize(),
            page: {
                curr: 1   //默认从第一页开始搜索
            },
            method: "get",
            //where: $("#sbumitForm").serialize(),
            limit: 20,
            limits: [20, 30, 50, 100, 200],
            text: {
                none: '暂无相关数据！'//默认无数据
            },
            response: {
                statusName: 'code', //数据状态的字段名称，默认：code
                statusCode: 0,//成功的状态码，默认：0
                msgName: 'msg', //状态信息的字段名称，默认：msg
                countName: 'count', //数据总数的字段名称，默认：count
                dataName: 'list', //数据列表的字段名称，默认：data
            },
            cols: [[
                {field: 'order_id', width: 240, title: '投注单号', align: 'center'},
                {field: 'created_at', width: 160, title: '投注时间', align: 'center'},
                {field: '', width: 130, title: '用户手机号', align: 'center',templet: function (item) {
                        if (item.user && item.user.mobile) {
                            return item.user.mobile;
                        }

                        return '-';
                    }
                },
                {field: '', width: 150, title: '用户昵称', align: 'center',templet: function (item) {
                        if (item.user && item.user.nick_name) {
                            return item.user.nick_name;
                        }

                        return '-';
                    }
                },
                {field: 'team_name', width: 160, title: '投注球队', align: 'center'},
                {field: 'current_odds', width: 110, title: '赔率', align: 'center'},
                {field: 'diamond', width: 135, title: '投注金额(宝石)', align: 'center'},
                {field: 'status', title: '状态', align: 'center', templet: function (item) {
                        if (item.status && item.status > 1) {
                            switch (item.status) {
                                case 2:
                                    return '+' + item.settle_diamond;
                                case 3:
                                    return '-' + item.diamond;
                            }
                        }

                        return '待开奖';
                    }
                },
            ]],
            done: function (res, curr, count) {
                res.list.forEach(function (item, index) {

                });
            },
        };
    }
</script>
</body>
</html>
